﻿using UnityEditor;
using UnityEngine;

/// <summary>
/// 创建AssetBundles
/// </summary>
public class BuildAssetBundle {




    [MenuItem("美术工具/打包场景资源/安卓")]
    static void BuildAllAssetBundles_android()
    {
        //生成的AssetBundles的文件夹
        string assetBundlesUrl = "Assets/StreamingAssets/Android_asset";
        //把预制物创建AssetBundles
        BuildPipeline.BuildAssetBundles(assetBundlesUrl, BuildAssetBundleOptions.None, BuildTarget.Android);
    }

    [MenuItem("美术工具/打包场景资源/苹果")]
    static void BuildAllAssetBundles_iphone()
    {
        //生成的AssetBundles的文件夹
        string assetBundlesUrl = "Assets/StreamingAssets/iOS_asset";
        //把预制物创建AssetBundles
        BuildPipeline.BuildAssetBundles(assetBundlesUrl, BuildAssetBundleOptions.None, BuildTarget.iOS);
    }

    [MenuItem("美术工具/打包场景资源/windows")]
    static void BuildAllAssetBundles_win32()
    {
        //生成的AssetBundles的文件夹
        string assetBundlesUrl = "Assets/StreamingAssets/Windows32_asset";
        //把预制物创建AssetBundles
        BuildPipeline.BuildAssetBundles(assetBundlesUrl, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows);
    }

    [MenuItem("美术工具/打包场景资源/windows64")]
    static void BuildAllAssetBundles_win64()
    {
        //生成的AssetBundles的文件夹
        string assetBundlesUrl = "Assets/StreamingAssets/Windows64_asset";
        //把预制物创建AssetBundles
        BuildPipeline.BuildAssetBundles(assetBundlesUrl, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows64);
    }

    [MenuItem("美术工具/注意事项")]
    static void 注意事项()
    {
        InfoScreen window = EditorWindow.GetWindow<InfoScreen>(true, "美术资源注意事项");
        window.minSize = window.maxSize = new Vector2(500, 500);
    }
}

public class InfoScreen : EditorWindow
{
    private Texture mSamplesImage;
    private Rect textRect = new Rect(15f, 15f, 500f, 150f);
    private Rect imageRect = new Rect(30f, 90f, 350f, 350f);

    public void OnGUI()
    {
        //GUI.DrawTexture(this.mWelcomeScreenImageRect, this.mWelcomeScreenImage);
        GUIStyle style = new GUIStyle();
        style.fontSize = 14;
        style.normal.textColor = Color.white;
        GUI.Label(this.textRect, "暂无\n", style);
        GUI.DrawTexture(this.imageRect, this.mSamplesImage);
    }
}
